package com.rockcent.service.impl;

import com.rockcent.mall.lib.domain.MerchantDeductionsFlow;
import com.rockcent.mall.lib.domain.enumclass.MerchantDeductionsStatus;
import com.rockcent.mall.lib.domain.enumclass.MerchantDeductionsType;
import com.rockcent.mall.lib.repository.MerchantDeductionsFlowRepository;
import com.rockcent.service.MerchantDeductionsFlowSrv;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.stereotype.Service;

/**
 * Created by zhangjh on 2017/4/5.
 */
@Service
public class MerchantDeductionsFlowSrvImpl implements MerchantDeductionsFlowSrv {
    @Autowired
    private MerchantDeductionsFlowRepository merchantDeductionsFlowRepository;

    @Override
    public MerchantDeductionsFlow findTop1ByMallIdAndMerchantIdAndSettlementDateAndDeductionsStatusAndDeductionsType(Long mallId, Long merchantId, String settlementTime, MerchantDeductionsStatus deductionsStatus, MerchantDeductionsType deductionsType) {
        return merchantDeductionsFlowRepository.findTop1ByMallIdAndMerchantIdAndSettlementDateAndDeductionsStatusAndDeductionsType(mallId,merchantId,settlementTime,deductionsStatus,deductionsType);
    }

    @Override
    public MerchantDeductionsFlow save(MerchantDeductionsFlow merchantDeductionsFlow) {
        return merchantDeductionsFlowRepository.save(merchantDeductionsFlow);
    }
}
